<?php

require_once('../config/config.php');
require_once('../lib/facebook.php');

require_once '../classes/PDO_Mysql.php';
require_once '../classes/Utiles.php';
require_once '../classes/User.php';
require_once '../classes/User_Info.php';
require_once '../classes/User_Question.php';
require_once '../classes/User_Reponse.php';
require_once '../classes/User_Info.php';
require_once '../classes/Score.php';
require_once('../classes/FriendPlus.php');

$action = isset($_POST['action']) && !empty ($_POST['action']) ? $_POST['action'] : null;
$fb = new FriendPlus(array(
       'appId'  => FB_APP_ID,
       'secret' => FB_SECRET_ID,
       'my_url' => FB_URL_CANEVAS,
       'cookie' => true,
));
switch($action){
    case 'getQuestion':
        $result = $fb->getQuestion(true);
        break;
    case 'saveResponse':
        $result = $fb->saveResponse($_POST);
        break;
    default : break;
}

print json_encode($result);

